//
//  MMenuItem.swift
//  SwiftStudy3.0
//
//  Created by mal on 17/2/10.
//  Copyright © 2017年 maliang. All rights reserved.
//

import UIKit

class MMenuItem: UIViewController {
    
    override func viewDidLoad() {
        
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.white
    }
    
    class func menuitem() -> MMenuItem?{
    
        return MMenuItem.init(nibName: nil, bundle: nil)
    }
}

enum MTransationType {
    case MPUSH,MPRESENT
}

class MMenuItemModel: AnyObject {
    
    let itemClass:AnyClass
    let des:String
    let transationType:MTransationType
    init(itemClass:AnyClass, des:String, transationType:MTransationType = .MPUSH) {
        
        self.itemClass = itemClass
        self.des = des
        self.transationType = transationType
    }
    
    func getItem() -> UIViewController? {
        
        var item:UIViewController?
        
        if  self.itemClass.responds(to: #selector(MMenuItem.menuitem)){
        
            item = self.itemClass.menuitem()
        }
        else{
        
            item = self.itemClass.alloc() as? UIViewController
        }
        return item
    }
}
